package com.personal.gateway.custom.customEnum.flinkCommandEnum;

import com.personal.gateway.flinkAllCommand.configurationOption.ConfigurationOption;
import com.personal.gateway.flinkAllCommand.configurationOption.configurationType.ConfigurationTypeEnumInterface;

import javax.annotation.Nonnull;

/**
 * @author BigHead
 * @date 2022/1/20 15:27
 * @description K8sLoadBalancerEnum
 */
public enum K8sLoadBalancerEnum implements ConfigurationTypeEnumInterface {

    /**
     * 内部IP模式
     */
    CLUSTER_IP("ClusterIP"),
    /**
     * 外显IP模式
     */
    NODE_PORT("NodePort"),
    /**
     * K8s第三方负载模块
     */
    LOAD_BALANCER("LoadBalancer")
    ;

    public final static Class<Enum<? extends ConfigurationTypeEnumInterface>> K8S_LOAD_BALANCER_TYPE_CLASS = (Class<Enum<? extends ConfigurationTypeEnumInterface>>) (Class<?>) K8sLoadBalancerEnum.class;


    private final String loadBalancerType;

    K8sLoadBalancerEnum(String loadBalancerType){
        this.loadBalancerType = loadBalancerType;
    }

    @Override
    public String getShowValue() {
        return name();
    }

    @Override
    public String getSelectValue() {
        return loadBalancerType;
    }

    @Override
    public boolean checkExist(@Nonnull String... values) {
        if (values.length == 1){
            return loadBalancerType.equals(values[0]);
        }
        return false;
    }

    @Override
    public boolean checkExist(ConfigurationOption<?, ?> configurationOption, @Nonnull String... values) {
        return false;
    }

    @Override
    public boolean checkExampleValue(ConfigurationOption<?, ?> configurationOption) {
        return false;
    }
}
